<!--script type="text/javascript">
		  var gridIncWlPathdata =  new Array();
          var queryIncWlPathdata =  new Array();
          var queryIncWlPathvo=new WlPathVOJs(); //
          var totalCountIncWlPath=0 ;
          var totalpageIncWlPath=0 ;
          var pagenumberIncWlPath=1;
          var pagesizeIncWlPath=10;     
		  var orderByIncWlPath='%';
          var gridIncWlPath=undefined;
          var modelIncWlPath = new dojox.grid.data.Table(null, gridIncWlPathdata);
		  var deletedatapath=new Array();
var editfieldpath =[{type: 'dojox.GridRowView', width: '20px' },{
    	 cells: [ [
					//{name: '????', width: 3, get:getChoise},
				   { name: 'choise', width: 3,field:0, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },//
				   { name: 'No.', width: 2, styles: 'text-align: center;', get: function(inRowIndex){ return inRowIndex+1;} },//
				   {name: 'pathName', field: 2,width: 10 , editor: mydojo.ValidationTextBox ,required:true ,maxLength:30,invalidMessage:'can not be empty'}
				,  {name: 'distance',field:3, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
				,  {name: 'loanStandard',field:4, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
				,  {name: 'time',field:5, width: 8,editor: dojox.grid.editors.Dijit, editorClass: "mydojo.NumberTextBox", constraint: {min:0,max:9999999,places:4 } }
				,  {name: 'startPlace', field: 6,width: 10 }
				,  {name: 'endPlace', field: 7,width: 10 }
				   ] ]
   }];		  
var getVOIncWlPath=function(queryIncWlPathvo,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath){

      var pu = new SOAPClientParameters2();
	  pu.add('endPlaceID',queryIncWlPathvo) ;
      //pu.add('WlPathVO',queryIncWlPathvo) ;
      //pu.add('pageNumber',pagenumberIncWlPath) ;
	   // pu.add('pageSize',pagesizeIncWlPath) ;
	   // pu.add('orderBy',orderByIncWlPath) ;
      SOAPClient.invoke(url,"getPathvoByEndPlace", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           queryIncWlPathdata=WlPathVOtoArray_fun(ul,false);
           totalCountIncWlPath=ul[ul.length-1]["ns:id"]; 
           totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
           document.getElementById("rowCountIncWlPath").innerHTML=" "+pagenumberIncWlPath+" / "+totalpageIncWlPath+" / "+totalCountIncWlPath+" " ;
      }); 
      queryIncWlPathdata.splice(queryIncWlPathdata.length-1,1);
      modelIncWlPath.setData(queryIncWlPathdata);
	  var button7 = new dijit.form.myButton({label: "pagedown", onClick: downPageIncWlPath,id:"but7IncWlPath",iconClass:"downPageIcon" });
	  document.getElementById("but7IncWlPathDiv").appendChild(button7.domNode);
	  if(totalpageIncWlPath>1){dijit.byId("but7IncWlPath").setDisabled(false);}else{dijit.byId("but7IncWlPath").setDisabled(true);}
	  //dijit.byId("grid").updateRowCount(queryIncWlPathdata.length); 
 }
//init-----------
alert(selectNode);
var endPlace=selectNode.item["eId"];
//if(selectNode!=)
 /*var pathendplace=new WlPlaceVOJs();
 pathendplace.id=selectNode.item["eId"];
 queryIncWlPathvo.endPlace=pathendplace;*/
 getVOIncWlPath(endPlace,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath); 
      //querydataInc.splice(querydataInc.length-1,1);
	  if(gridIncWlPath==undefined){
	  modelIncWlPath = new dojox.grid.data.Table(null, queryIncWlPathdata);
				 gridIncWlPath = new dojox.Grid({
					title: "",
					id: "gridIncWlPath",
					jsId: "gridIncWlPath",
					structure: editfieldpath,
					rowCount:queryIncWlPathdata.length-1,
					model:modelIncWlPath,
					singleClickEdit:true
				}, dojo.byId("gridIncWlPath"));
				
			}else{ gridIncWlPath.model.setData(queryIncWlPathdata); } 
	 //if(totalpageIncWlPath>1){dijit.byId("but7IncWlPath").setDisabled(false);}else{dijit.byId("but7IncWlPath").setDisabled(true);}	
//-------------	

   
var querybuttonIncWlPath=function(){
              //var p = new SOAPClientParameters2();
              var d,n;
              var validstate=0;
              //queryIncWlPathvo.id=0 ;
              queryIncWlPathvo=new WlPathVOJs();
              if(querypathNameIncWlPath.getDisplayedValue()!="")queryIncWlPathvo.pathName=querypathNameIncWlPath.getDisplayedValue();//
              n=queryNumber_fun("distance");
              if(n==null){validstate=1;}else if(n.upSign!="%"){queryIncWlPathvo.distance=n;}  
              n=queryNumber_fun("loanStandard");
              if(n==null){validstate=1;}else if(n.upSign!="%"){queryIncWlPathvo.loanStandard=n;}  
              n=queryNumber_fun("time");
              if(n==null){validstate=1;}else if(n.upSign!="%"){queryIncWlPathvo.time=n;}  
        if(validstate==0){
              pagenumberIncWlPath=1;
              getVOIncWlPath(queryIncWlPathvo,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath); 
              //if(totalpageIncWlPath>1){dijit.byId("but7IncWlPath").setDisabled(false);}else{dijit.byId("but7IncWlPath").setDisabled(true);} 
             }      
       }


 

 
var querydisIncWlPath = function(){   querydisplay("queryDivIncWlPath");   }
var allpageIncWlPath =function(){
      pagenumberIncWlPath=0;pagesizeIncWlPath=0;
      getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);
 }
var  pagesizeChangeIncWlPath=function(mylabel){
    pagesizeIncWlPath=mylabel;
    getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);
 }           
var upPageIncWlPath= function(){
     
     var pagenumbers=new Number(pagenumberIncWlPath)-1;
     pagenumberIncWlPath=pagenumbers.toString();
     getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);
        //dijit.byId("grid").updateRowCount(querydata.length);      //dijit.byId("grid").update();
  			if(pagenumber==1){
        dijit.byId("but6IncWlPath").setDisabled(true);
        }
        var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
        if(totalpageIncWlPath>pagenumberIncWlPath){
        dijit.byId("but7IncWlPath").setDisabled(false);
        }
        var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
        document.getElementById("rowCountIncWlPath").innerHTML=" "+pagenumberIncWlPath+" / "+totalpageIncWlPath+" / "+totalCountIncWlPath+" " ; 
}
var downPageIncWlPath =function(){

       var pagenumbers=new Number(pagenumberIncWlPath)+1;
       pagenumberIncWlPath=pagenumbers.toString();
      getVOIncWlPath(queryvoIncWlPath,pagenumberIncWlPath,pagesizeIncWlPath,orderByIncWlPath);  
      //dijit.byId("grid").updateRowCount(querydata.length);      //dijit.byId("grid").update();
			var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
			if(totalpageIncWlPath==pagenumberIncWlPath){
			dijit.byId("but7IncWlPath").setDisabled(true);
      }
      if(pagenumber>1){
      dijit.byId("but6IncWlPath").setDisabled(false);
      }
      var totalpageIncWlPath=Math.ceil(new Number(totalCountIncWlPath)/pagesizeIncWlPath);
      document.getElementById("rowCountIncWlPath").innerHTML=" "+pagenumberIncWlPath+" / "+totalpageIncWlPath+" / "+totalCountIncWlPath+" " ; 
      
}

var call_funUpdpath =function() {
       //var s = gridIncWlPath.selection.getSelected();
       //var  d=new DateTimeQuery();
       //var n=new NumberQuery();
       var sall=gridIncWlPath.model.data;
       for(var i=0;i<sall.length;i++){
       if(sall[i][0]==true){
         var passAll=0;
         var thisCell=sall[i];
         var padd = new SOAPClientParameters2();
         var vobject=new WlPathVOJs();
         vobject.id=thisCell[1];
              if(dojox.validate.isText(thisCell[2], {minlength: 1})){vobject.pathName=thisCell[2];
             }else{gridIncWlPath.getCell(2).getNode(i).innerHTML="<span style={color:red;line-height:16px}>can not be null</span>"; passAll=1;}//not null
 
             if(dojox.validate.isInRange(thisCell[3],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[3];vobject.distance=n;
             }else{gridIncWlPath.getCell(3).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[4],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[4];vobject.loanStandard=n;
             }else{gridIncWlPath.getCell(4).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double

             if(dojox.validate.isInRange(thisCell[5],{max:9999999, min:0})){
              var  n=new NumberQuery(); n.upNumber=thisCell[5];vobject.time=n;
             }else{gridIncWlPath.getCell(5).getNode(i).innerHTML="<span style={color:red;line-height:16px}> not be double</span>";passAll=1;}//double
       if(passAll==0){
             if(thisCell[1]==0){//create new row
                padd.add('WlPathVO',vobject);
                SOAPClient.invoke(url, "createWlPath", padd, false,  function GetEnu_callBack(ul, soapResponse){
                gridIncWlPath.model.setDatum(ul,i,1);
                });
	         }else{//modify row
                padd.add('WlPathVO',vobject);
                SOAPClient.invoke(url, "updateWlPath", padd, false,  function GetEnu_callBack(ul, soapResponse){
                });
	         }
        } }}//for
//submit delete
          for(var i=0;i<deletedatapath.length;i++){
               var pdel = new SOAPClientParameters();      
               pdel.add('id',deletedatapath[i]);
               SOAPClient.invoke(url, "deleteWlPath", pdel, false,  function GetEnu_callBack(ul, soapResponse){
	             
	           });
          }
          deletedatapath=new Array();
          dojo.byId("rowCountIncWlPath").innerHTML = 'saved'; 
//submit delete end          
 }

var removeSelectedRowsGridpath= function(){
       //var s = gridIncWlPath.selection.getSelected();
       var s= new Array();
       var sall=gridIncWlPath.model.data;
       for(var i=0;i<sall.length;i++){
       if(sall[i][0]==true){
          s.push(i);
          var thisCell=sall[i];
          if(thisCell[1]!=0){//the row which will be deleted
            deletedatapath.splice(deletedatapath.length,0,thisCell[1]);
       }}}
       gridIncWlPath.model.remove(s);//gridIncWlPath.removeSelectedRows();
 }
        
var addRowpath = function(){
          	gridIncWlPath.addRow([false,0,"","",""],gridIncWlPath.model.getRowCount());
	        } 


</script-->

<div id="queryDivIncWlPath" style="margin-right: 0px;  height: 460px; display:none;" >
              <table align="center" width=100% class="queryTable"  >
                <tr ><td align="center" style="{width:11%}">Please input criterial:</td>
                <td style="{width:22%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}" ></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:22%}"></td></tr> 
                <tr ><td align="center" style="{width:11%}"></td>
                <td style="{width:22%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}" ></td>
                <td style="{width:6%}" ></td>
                <td style="{width:11%}"></td>
                <td style="{width:22%}"></td></tr>  
                <tr>
                    <td align="right"  >pathName:</td>
                    <td align="left"  ><input type="text" class="editerInput"  id="querypathNameIncWlPath"  jsId="querypathNameIncWlPath"   dojoType="dijit.form.TextBox"  /></td>
                    <td align="right"  >distance:</td>
                    <td align="left" colspan="3" ><span id="querydistanceIncWlPathImg0"  ><input type="text" class="editerNumber" jsId="querydistanceIncWlPath"  id="querydistanceIncWlPath"  dojoType="mydojo.NumberTextBox"  /></span>
                        <span id="querydistanceIncWlPathImg1"  style="{display:none}" ><input type="text" class="editerNumberSmall" jsId="querydistanceIncWlPath1"  id="querydistanceIncWlPath1"  dojoType="mydojo.NumberTextBox"  /></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="querydistanceIncWlPathImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="querydistanceIncWlPathImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="querydistanceIncWlPathImgdown" >></span>
                        <span id="querydistanceIncWlPathImg2div" style="{display:none}"> <input type="text" class="editerNumberSmall"  jsId="querydistanceIncWlPath2"  id="querydistanceIncWlPath2"  dojoType="mydojo.NumberTextBox"  /></span>
                    </td>  
                    <td align="right"  >loanStandard:</td>
                    <td align="left"  ><span id="queryloanStandardIncWlPathImg0"  ><input type="text" class="editerNumber" jsId="queryloanStandardIncWlPath"  id="queryloanStandardIncWlPath"  dojoType="mydojo.NumberTextBox"  /></span>
                        <span id="queryloanStandardIncWlPathImg1"  style="{display:none}" ><input type="text" class="editerNumberSmall" jsId="queryloanStandardIncWlPath1"  id="queryloanStandardIncWlPath1"  dojoType="mydojo.NumberTextBox"  /></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="queryloanStandardIncWlPathImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="queryloanStandardIncWlPathImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="queryloanStandardIncWlPathImgdown" >></span>
                        <span id="queryloanStandardIncWlPathImg2div" style="{display:none}"> <input type="text" class="editerNumberSmall"  jsId="queryloanStandardIncWlPath2"  id="queryloanStandardIncWlPath2"  dojoType="mydojo.NumberTextBox"  /></span>
                    </td>  
              </tr>
                <tr>
                    <td align="right"  >time:</td>
                    <td align="left"  ><span id="querytimeIncWlPathImg0"  ><input type="text" class="editerNumber"   jsId="querytimeIncWlPath"  id="querytimeIncWlPath"  dojoType="mydojo.NumberTextBox"  /></span>
                        <span id="querytimeIncWlPathImg1" style="{display:none}" ><input type="text"  class="editerNumberSmall" jsId="querytimeIncWlPath1"  id="querytimeIncWlPath1"  dojoType="mydojo.NumberTextBox"  /></span>
                        <span hidefocus="true" style="{display:none}" onclick="selectSign(this);" id="querytimeIncWlPathImgup">></span>
                        <img src="../image/start.gif" onclick="queryType(this);" id="querytimeIncWlPathImg" height="15" width="20" border="0">
                        <span hidefocus="false"  style="{display:none}" onclick="selectSign(this);" id="querytimeIncWlPathImgdown" >></span>
                        <span id="querytimeIncWlPathImg2div" style="{display:none}"> <input type="text"  class="editerNumberSmall"  jsId="querytimeIncWlPath2"  id="querytimeIncWlPath2"  dojoType="mydojo.NumberTextBox"  /></span>
                    </td>
	
          <tr align="center"><td></td>
           <td colspan="2"><a onclick="querybuttonIncWlPath();"><img src="../image/332.gif" height="20" width="20" border="0">OK</a></td>
           <td colspan="3"></td><td colspan="2"></td></tr>
         </table>
	     </div>
	       	<div align="right">
	          	 &nbsp;&nbsp;&nbsp;
	          	     <button dojoType="dijit.form.Button" onclick="addRowpath();" iconClass="addIcon" >add</button>
	                 <button dojoType="dijit.form.Button" onclick="removeSelectedRowsGridpath();" iconClass="delIcon" >delete</button>
	                 <button dojoType="dijit.form.Button" id="but3path" jsId="but3path" onclick="call_funUpdpath();"  iconClass="saveIcon">save</button>
	          	     <button dojoType="dijit.form.Button" onclick="querydisIncWlPath();" iconClass="queryIcon" >query</button>
          </div>  
	       
	    <div style="{height:90%;width:100%}"  >
	         <!--div id="gridIncWlPath"  dojoType="dojox.Grid" autoWidth="false"  jsId="gridIncWlPath"	model="modelIncWlPath"  structure="editfieldpath" singleClickEdit="true" ></div-->
			 <div id="gridIncWlPath" ></div>
      </div>      
      <div align="right" ><span id="rowCountIncWlPath"></span>
        <button dojoType="dijit.form.myButton" onclick="upPageIncWlPath();"  id="but6IncWlPath" disabled='false' jsId="but6IncWlPath" iconClass="upPageIcon" >pageup</button><!--span dojoType="dijit.Tooltip" connectId="but6">pageup</span-->
        <button dojoType="dijit.form.myButton" onclick="downPageIncWlPath();" id="but7IncWlPath" disabled='false' jsId="but7IncWlPath" iconClass="downPageIcon" >pagedown</button><!--span dojoType="dijit.Tooltip" connectId="but7">pagedown</span-->
		<!--span id="but7IncWlPathDiv" ></span-->
        <div  dojoType="dijit.form.myDropDownButton" iconClass="pageIcon" ><span>pageNumber</span>
  			  <div dojoType="dijit.Menu">
				  <div dojoType="dijit.MenuItem" label="10"  iconClass="toPageIcon"		onClick="pageSizeChangeIncWlPath(this.label);"></div>
				  <div dojoType="dijit.MenuItem"  label="30" iconClass="toPageIcon"		onClick="pageSizeChangeIncWlPath(this.label);"></div>
		      <div dojoType="dijit.MenuItem"  label="50" iconClass="toPageIcon"		onClick="pageSizeChangeIncWlPath(this.label);"></div>
					<div dojoType="dijit.MenuItem"  label="100" iconClass="toPageIcon"	onClick="pageSizeChangeIncWlPath(this.label);"></div>
					<div dojoType="dijit.MenuItem"  label="noPage" iconClass="noPageIcon"	onClick="allpageIncWlPath();"></div>
		      </div><!--span dojoType="dijit.Tooltip" connectId="668"></span-->
        </div>
		    <div dojoType="dijit.form.myDropDownButton" iconClass="pageStyleIcon"><span>pageStyle</span>
  			   <div dojoType="dijit.Menu">
  				 <div dojoType="dijit.MenuItem"  iconClass="rowIcon"		label="row"	onClick="pageStyleIncWlPath(this.label);"></div>
  				 <div dojoType="dijit.MenuItem"  iconClass="colIcon"		label="col"	onClick="pageStyleIncWlPath(this.label);"></div>
		    </div></div>
     </div>
